package spider2

import (
	"fmt"
	"regexp"
)

func main() {

	parser := CityParser{}
	fmt.Printf("%p\n", &parser)
	a := Request{Url: "http://www.zhenai.com/zhenghun", Parser: &parser}
	concurrentEngine := ConcurrentEngine{}
	concurrentEngine.Run(a)
}

func printCityList(content []byte) {
	//compile, _ := regexp.Compile(`<a data-v-[\w\d]+="" href="(http://www.zhenai.com/zhenghun/[\w\d]+)">([^<>]+)</a>`)
	compile, _ := regexp.Compile(`<a href="(http://www.zhenai.com/zhenghun/[\w\d]+)" data-v-[\w\d]+>([^<>]+)</a>`)
	submatch := compile.FindAllSubmatch(content, -1)
	for _, v := range submatch {
		fmt.Printf("%s", v[1])
		fmt.Printf("%s", "-")
		fmt.Printf("%s", v[2])
		fmt.Println()
	}
}
